package application;
import base.*;
import java.util.Scanner;

/**
 * this class realizes the Computer and Phone class
 * @author FlowerYang
 * @ver 1.0.0
 */

public class Main {
    Scanner input = new Scanner(System.in);
    Electronics E = new Electronics(50.0, 500.0, 20, "Meidi");
    Computer C = new Computer(30.0, 7999, 20, "Apple", "16G", "M1");
    Phone P = new Phone(7.0, 8848, 20, "Bilibili", "Android", 128.0);

    public static void main(String[] args) {
        Main App = new Main();
        App.Init();
        while(true) {
            App.Menu();
        }
    }

    private void Menu() {
        System.out.println("1.InitInfo");
        System.out.println("2.SetInfo");
        System.out.println("3.PrintInfo");
        System.out.println("4.quit");
        int x = input.nextInt();
        if (x == 1) Init();
        if (x == 2) Set();
        if (x == 3) PrintInfo();
        if(x==4)System.exit(0);
    }

    private void Set(){
        E.setPower(input.nextDouble());
        E.setPrice(input.nextDouble());
        C.setPower(input.nextInt());
        C.setPrice(input.nextInt());
        C.setMem_info(input.nextLine());
        C.setCpu_info(input.nextLine());
        P.setOS_info(input.nextLine());
        P.setStorage_info(input.nextInt());
        P.setPrice(input.nextInt());
    }
    private void PrintInfo() {
        E.outputInfo();
        C.show_Computer();
        P.show_Phone();
    }

    private void Init(){
        /**
         * Realize Electronic Class
         */
        E.setPower(30.0);
        E.setPrice(233.0);

        /**
         * Realize Computer Class
         */
        C.setPower(30);
        C.setPrice(12999);
        C.setMem_info("128G");
        C.setCpu_info("M2");

        /**
         * Realize Phone Class
         */
        P.setOS_info("IOS");
        P.setStorage_info(256);
        P.setPrice(12999);

    }
}
